-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BitPackedArray::scalar_at #160
Conversation
depends on #179 |
9dcc6c0
to
cfb5136
Compare
cfb5136
to
fe826a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should benchmark this. There's quite a lot of logic for 1 scalar and I think there's quite a lot of room to improve performance
benchmark results at commit e88374f on my MacBook Air M2: ~/g/vortex ❯❯❯ cargo bench --bench bitpacking
Compiling vortex-fastlanes v0.1.0 (/Users/will/git/vortex/vortex-fastlanes)
Finished `bench` profile [optimized] target(s) in 1.83s
Running benches/bitpacking.rs (target/release/deps/bitpacking-274b666c83950221)
Gnuplot not found, using plotters backend
bitpack_1M time: [55.673 µs 55.768 µs 55.883 µs]
Found 13 outliers among 100 measurements (13.00%)
11 (11.00%) high mild
2 (2.00%) high severe
unpack_1M time: [224.61 µs 240.60 µs 258.08 µs]
Found 11 outliers among 100 measurements (11.00%)
6 (6.00%) high mild
5 (5.00%) high severe
unpack_1M_singles time: [2.2627 ms 2.2864 ms 2.3125 ms]
Found 13 outliers among 100 measurements (13.00%)
8 (8.00%) high mild
5 (5.00%) high severe
unpack_1024 time: [43.631 ns 43.774 ns 43.928 ns]
Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe
unpack_single time: [4.9211 ns 4.9358 ns 4.9515 ns]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild |
fn scalar_at(&self, index: usize) -> VortexResult<Scalar> { | ||
if index >= self.len() { | ||
return Err(vortex_err!(OutOfBounds:index, 0, self.len())); | ||
} | ||
if self.bit_width() == 0 { | ||
let ptype = self.dtype().try_into()?; | ||
match_each_integer_ptype!(&ptype, |$P| { | ||
return Ok(Scalar::from(0 as $P)); | ||
}) | ||
} | ||
unpack_single(self, index) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to take patches into account
No description provided.